/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vfi.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "VFI_TRANSACCION")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "XTIPO")
@NamedQueries({@NamedQuery(name = "Transaccion.findAll", query = "SELECT t FROM Transaccion t"), @NamedQuery(name = "Transaccion.findByIdTransaccion", query = "SELECT t FROM Transaccion t WHERE t.idTransaccion = :idTransaccion"), @NamedQuery(name = "Transaccion.findByFechaHora", query = "SELECT t FROM Transaccion t WHERE t.fechaHora = :fechaHora")})
public abstract class Transaccion implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_TRANSACCION", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Long idTransaccion;
    @Column(name = "FECHA_HORA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaHora;
    @Column(name = "XTIPO", length = 3)
    private String xtipo;

//    @OneToOne(cascade = CascadeType.ALL, mappedBy = "transaccion", fetch = FetchType.LAZY)
//    private TranFinanciera tranFinanciera;
    public Transaccion() {
    }

    public Transaccion(Long idTransaccion) {
        this.idTransaccion = idTransaccion;
    }

    

    public Transaccion(Long idTransaccion, Date fechaHora, String xtipo) {
        this.idTransaccion = idTransaccion;
        this.fechaHora = fechaHora;
        this.xtipo = xtipo;
    }

    public Long getIdTransaccion() {
        return idTransaccion;
    }

    public void setIdTransaccion(Long idTransaccion) {
        this.idTransaccion = idTransaccion;
    }

    public Date getFechaHora() {
        return fechaHora;
    }

    public void setFechaHora(Date fechaHora) {
        this.fechaHora = fechaHora;
    }

//    public TranFinanciera getTranFinanciera() {
//        return tranFinanciera;
//    }
//
//    public void setTranFinanciera(TranFinanciera tranFinanciera) {
//        this.tranFinanciera = tranFinanciera;
//    }
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransaccion != null ? idTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Transaccion other = (Transaccion) obj;
        if (this.idTransaccion != other.idTransaccion && (this.idTransaccion == null || !this.idTransaccion.equals(other.idTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.Transaccion[idTransaccion=" + idTransaccion + "]";
    }

    /**
     * @return the xtipo
     */
    public String getXtipo() {
        return xtipo;
    }

    /**
     * @param xtipo the xtipo to set
     */
    public void setXtipo(String xtipo) {
        this.xtipo = xtipo;
    }
}
